import requests

# 登录参数
login_payload = {
    "phone": "17620084608",
    "login_pdw": "asd1234567",
    "sign": "7E941261FE6662EC5561F90762B2190B",
    "timestamp": 1702956948
}

# 登录URL
login_url = "https://www.aimtes.xyz/api/v1/pwd_login"

# 签到URL
# sign_url = "https://www.aimtes.xyz/api/v1/user/sign"
sign_url = "https://www.aimtes.xyz/api/v1/user/everyday_list"
# 发送登录请求
login_response = requests.post(login_url, json=login_payload)

# 检查登录是否成功
if login_response.status_code == 200:
    print("响应内容:")
    print(login_response.text)
    # 提取登录后的 token
    token = login_response.json()["data"]["token"]
    print("token:")
    print(token)
    # 检查是否获取到 token
    if token:
        # 隐藏登录信息，设置 User-Agent 和 Authorization 头部
        headers = {
            "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
            "Authorization": token,
            "Content-Type": "application/json",
            "Referer": "https://www.aimtes.xyz/",
            "Origin": "https://www.aimtes.xyz",
            "Sec-Fetch-Dest": "empty",
            "Sec-Fetch-Mode": "cors",
            "Sec-Fetch-Site": "cross-site",
        }
        print("headers:")
        print(headers)
        # 发送签到请求
        sign_response = requests.get(sign_url, headers=headers)

        # 检查签到是否成功
        if sign_response.status_code == 200:
            # 打印签到成功后的结果
            print("签到成功，响应内容:")
            print(sign_response.text)
        else:
            print(f"签到失败，状态码: {sign_response.status_code}")
            print("响应内容:")
            print(sign_response.text)
    else:
        print("未获取到 token")
else:
    print(f"登录失败，状态码: {login_response.status_code}")
    print("响应内容:")
    print(login_response.text)
